<!DOCTYPE html>
<html>

	<head lang="en">
		<title>评论</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<script src="/js/jquery/jquery.min.js"></script>
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
		<link rel="stylesheet" href="/css/reset.css" />
		<link rel="stylesheet" href="/css/myStrategyComment.css" />
        <link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
        <script src="/js/plugins/dialog/dialog.min.js"></script>
		<link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
        <script src="../js/plugins/jquery-form/jquery.form.js"></script>
		<script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
		<script src="/js/jquery-validation/jquery.validate.min.js"></script>
		<script src="/js/common.js"></script>

        <script>
            $(function () {
                //表单验证
                $("#replyForm").validate({
                    rules: {
                        content: {
                            required: true
                        }
                    },
                    messages: {
                        content:{
                            required:"请输入内容"
                        }
                    }
                })

                //提交保存操作
                // 获取攻略点评id
				var strategyCommentId = getParams().strategyCommentId;
                // 设置表单提交的action
                $("#replyForm").attr("action", "/strategyComments/"+strategyCommentId+"/replies");
                //点击提交评价按钮提交表单
                $("#submitBtn").click(function () {
                   $("#replyForm").submit();
                });
                //将表单的提交变成异步请求,并添加提交的字段
                $("#replyForm").ajaxForm(function (data) {
                    if (data.success){
                        // 保存成功跳转到点评详情界面
                        window.location.href = "/strategyComment.html?id="+strategyCommentId;
                    } else {
                        // 如果不成功, 则弹框提示服务器繁忙, 请稍后再试
                        $(document).dialog({
                            titleText: '温馨提示',
                            position:"bottom",
                            content: data.msg
                        });
                    }
                })

            })
        </script>

		<style>
			.error{
				color:red;
			}
		</style>
	</head>

	<body>
	<div class="search-head">
		<div class="row nav-search">
			<div class="col">
				<a href="javascript:window.history.go(-1)">
					<span><i class="fa fa-chevron-left" ></i></span>
				</a>

			</div>
			<div class="col">
				<span>添加评论</span>
			</div>
			<div class="col"></div>
		</div>
	</div>

	<form class="comment reply" id="replyForm" method="post">
		<div class="container">
			<p>请输入你的评论</p>
			<textarea name="content" id="content" class="form-control" rows="5" placeholder="请填写你对该攻略点评的评价"></textarea>
		</div>
	</form>

	<div class="operation">
		<button class="btn" onclick="window.history.go(-1)">放弃评论</button>
		<button class="btn" id="submitBtn">提交评论</button>
	</div>

	</body>


</html>